﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HealthCenter.MECReportService;
using HealthCenter.ScarsProductSearchService;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Net;

namespace HealthCenter
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //BasicHttpBinding bhb = new BasicHttpBinding();

            //bhb.UseDefaultWebProxy = true;

            //EndpointAddress ea = new EndpointAddress("http://www.scars.org.cn/FPWEB/WebService/MECReport.asmx");

            //MECReportSoapClient client = new MECReportSoapClient(bhb, ea);

            SearchesServiceSoapClient client = new SearchesServiceSoapClient("SearchesServiceSoap12");


            //client.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
            using (new OperationContextScope(client.InnerChannel))
            {
                HttpRequestMessageProperty requestProperty = new HttpRequestMessageProperty();
                requestProperty.Headers.Add("Cookie", GlobalInfo.cookie);
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestProperty;

                string[] ss = client.SearchMerchandiseName("");
                if (ss != null)
                {
                    foreach (string s in ss)
                    {
                        textBox1.AppendText(s);
                        textBox1.AppendText(Environment.NewLine);
                    }
                }
            }
        }
    }
}
